<template>
  <a href="javascript: void(0);" @click="modalOpen=true">注册</a>
  <teleport to="body">
    <div class="modal" v-if="modalOpen">
      <div class="box">
        <div class="title">
          <span>用户注册</span>
        </div>
        <div class="inp">
          <input type="text" placeholder="手机号码">
          <input type="text" placeholder="验证码">
          <br>
          <button class="reg-button" @click="modalOpen=false">注&nbsp;册</button>
          <p class="go-login">已经注册账号

              <Login/>

          </p>
        </div>
      </div>

    </div>
  </teleport>
</template>

<script>
import {ref} from "vue"
import Login from "@/components/Login";
export default {
  name: "Register",
  components: {Login},
  setup() {
    const modalOpen = ref(false)
    return {
      modalOpen
    }
  }
}
</script>

<style scoped>
.modal {
  /* 产生一个遮罩效果 */
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, .5);
  z-index: 2;

  /* 布局内容:水平居中, 垂直居中 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal .box {
  /* 产生一个白色背景的矩形框 */
  width: 300px;
  height: 300px;
  background-color: #fff;
  border-radius: 5px;
}

.box .title {
  height: 50px;
  line-height: 50px;
  border-bottom: 1px solid #e6e6e6;
  text-align: center;

  font-size: 16px;
  font-weight: bold;
  color: #9b9b9b;
}

.box .inp {
  margin-top: 15px;
  text-align: center;
}

.box .inp input {
  width: 80%;
  height: 30px;
  margin-bottom: 25px;
  padding: 0;

  font-size: 14px;
}
.reg-button{
  width: 80%;
  height: 40px;
  background: #84cc39;
  border:1px solid #84cc39;
  border-radius: 5px;
  font-size: 16px;
  color: #fff;
}
.go-login {
  margin-top: 15px;
  font-size: 14px;
}
</style>